# -*- coding:utf-8 -*-
# @FileName  :adhcc_0_setup.py
# @Time      :2020/12/25 14:54
# @Author    :Zhoujirong
# @Desc      : 初始化征信用户

from common.log import Log
from biz.flow.per_credit_user import PerCreditUserRequest
from biz.cases.base_case import BaseCase
from common.utils import get_redis,get_mysql

class TestSetUpCreditUser(BaseCase):
    '''初始化征信用户'''
    data_file_name = 'setup.yaml'

    @classmethod
    def setUpClass(cls):
        cls.redis = get_redis()
        cls.cookie = BaseCase().get_token_first()

    def test_a_credist_user_create_web(self):
        '''添加征信页面用户'''
        creditName = self.file_data.get('creditName_web')
        creditUser = self.file_data.get('creditUser_web')
        creditOrgCode = self.file_data.get('creditOrgCode')
        creditPassword = self.file_data.get('creditPassword')
        deptCode = self.file_data.get('deptCode')
        userClass = self.file_data.get('userClass')
        digitalCertificate = self.file_data.get('digitalCertificate')
        userType = self.file_data.get('userType_web')
        remarks = self.file_data.get('remarks_web')
        userStatus = self.file_data.get('userStatus')
        ret = PerCreditUserRequest.per_create(creditName,creditUser,creditOrgCode,creditPassword,deptCode,userClass,digitalCertificate,userType,remarks,userStatus,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000', ret.code, '接口调用失败')

    def test_b_credist_user_create_api(self):
        '''添加征信接口用户'''
        creditName = self.file_data.get('creditName_api')
        creditUser = self.file_data.get('creditUser_api')
        creditOrgCode = self.file_data.get('creditOrgCode')
        creditPassword = self.file_data.get('creditPassword')
        deptCode = self.file_data.get('deptCode')
        userClass = self.file_data.get('userClass')
        digitalCertificate = self.file_data.get('digitalCertificate')
        userType = self.file_data.get('userType_api')
        remarks = self.file_data.get('remarks_api')
        userStatus = self.file_data.get('userStatus')
        ret = PerCreditUserRequest.per_create(creditName,creditUser,creditOrgCode,creditPassword,deptCode,userClass,digitalCertificate,userType,remarks,userStatus,self.cookie)
        Log.info(ret)
        self.assertEqual('00000000', ret.code, '接口调用失败')




if __name__ == "__main__":
    pass